@import 'variables';
@import 'mixins';
@import 'prism';

.explorer {
  > div {
    height: 100%;
  }
  .close {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    padding: 6px 12px;
    height: 28px;
    cursor: pointer;
    opacity: 0.7;
    color: $light-color;
    svg {
      width: 14px;
    }
    &:hover {
      opacity: 1;
    }
  }
  .colset-explorer {
    position: relative;
    padding: 0 30px;
    height: 100%;
    display: flex;
    max-width: $spring-max-width - ((75 + 30) * 2);
    margin: 0 auto;
    .right,
    .left {
      max-width: none;
      padding: 0;
      text-align: left;
      font-weight: normal;
      height: 100%;
      position: relative;
    }
    .left {
      flex: 0 0 320px;
      // border-right: 1px solid $light-border;
    }
    .head {
      border: 1px solid $light-border;
      border-bottom: 0;
      line-height: 50px;
      padding: 0 $spring-8points * 2;
      position: absolute;
      top: 30px;
      left: 0;
      height: 50px;
      right: 0;
      font-size: 16px;
      .divider {
        display: inline-block;
      }
      .actions-file {
        display: inline-block;
        height: 40px;
        margin-left: 16px;
        color: rgba(0, 0, 0, 0.2);
        .placeholder-button {
          margin-right: 1rem;
          height: 36px;
        }
      }
      a.button {
        span.button-content span {
          cursor: pointer;
          padding: 0.55rem 1.2rem 0.4rem;
          font-size: 13px;
        }
      }
      .placeholder-text {
        margin: 18px 0 0;
      }

      .placeholder-title {
        .placeholder-text {
          margin-right: 5px;
        }
      }
    }
    .explorer-content {
      position: absolute;
      top: 81px;
      bottom: 130px;
      right: 0;
      left: 0;
      overflow: auto;
      border: 1px solid $light-border;
    }
    .right {
      flex: 1;
      .head {
        margin-left: 2rem;
        border: 0 none;
        text-align: center;
        strong {
          position: relative;
          padding-left: 20px;
          svg {
            position: absolute;
            top: 3px;
            left: 0;
            width: 13px;
          }
        }
      }
      .placeholder-text {
        background: $light-placeholder;
      }
      .explorer-content {
        overflow: auto;
        margin-left: 2rem;
        &::-webkit-scrollbar {
          height: 6px;
          width: 6px;
          background: transparent;
        }
        &::-webkit-scrollbar-thumb {
          background: rgba(black, 0.3);
        }
      }
    }
  }
  .icon-download {
    width: 16px;
  }
}

.explorer-select {
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  height: 35px;
  z-index: 1000;
  select {
    display: block;
    position: relative;
    height: 35px;
    line-height: 35px;
    -webkit-appearance: none;
    background: white;
    border-radius: 0;
    box-sizing: border-box;
    background-clip: padding-box;
    width: 100%;
    padding: 0 10px;
    border: 1px solid $light-border;
    background: $light-background;
    color: $light-color;
    font-weight: 600;
    box-shadow: none;
    outline: none;
    padding-right: 30px;
    &:-ms-expand {
      display: none;
    }
  }
  &:before {
    content: '';
    position: absolute;
    z-index: 1;
    top: 30%;
    height: 0;
    width: 0;
    right: 5px;
    border-bottom: 6px solid $light-color;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    pointer-events: none;
  }
  &:after {
    content: '';
    position: absolute;
    z-index: 2;
    bottom: 30%;
    margin-top: -3px;
    height: 0;
    width: 0;
    right: 5px;
    border-top: 6px solid $light-color;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    pointer-events: none;
  }
}

.placeholder-explorer-select {
  &:after,
  &:before {
    display: none;
  }
}

.placeholder-select {
  border: 1px solid $light-border;
  background: $light-background;
  height: 35px;
}

.explorer-ul {
  &,
  ul {
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 15px;
    line-height: 35px;
  }
  span {
    display: block;
  }
  .file,
  .folder {
    position: relative;
    display: block;
    cursor: pointer;
    text-decoration: none;
    color: $light-color;
    word-wrap: normal;
    white-space: nowrap;
    .item-content {
      box-shadow: none;
      outline: none;
    }
    &:hover {
      background: $light-background-seconday;
    }
    .text {
      position: relative;
      padding-left: 50px;
      margin: 0 8px;
    }
    .icon {
      display: block;
      position: absolute;
      top: 5px;
      left: 18px;
      height: 20px;
      width: 20px;
      color: $light-color;
    }
    .icon-caret-down {
      display: block;
      position: absolute;
      z-index: 1000;
      top: 10px;
      left: 0;
      height: 16px;
      width: 16px;
    }

    outline: 1px dotted transparent;
    &:focus {
      outline: 1px dotted darken($light-background-seconday, 10);
    }

    &.disabled {
      opacity: 0.4;
      cursor: not-allowed;
      &:hover {
        background: transparent;
      }
      &:focus {
        outline: 1px dotted transparent;
      }
    }
    &.selected {
      background: $light-background-seconday;
      font-weight: bold;
      color: #6db33f;
    }
  }

  .folder-hide {
    > ul {
      display: none;
    }
    > .folder > span > .text > .icon-caret-down {
      transform: rotate(-90deg);
    }
  }

  $range: 12px;

  .level-0 {
    .text {
      margin-left: 0 * $range + 6px;
    }
  }
  .level-1 {
    .text {
      margin-left: 1 * $range + 6px;
    }
  }
  .level-2 {
    .text {
      margin-left: 2 * $range + 6px;
    }
  }
  .level-3 {
    .text {
      margin-left: 3 * $range + 6px;
    }
  }
  .level-4 {
    .text {
      margin-left: 4 * $range + 6px;
    }
  }
  .level-5 {
    .text {
      margin-left: 5 * $range + 6px;
    }
  }
  .level-6 {
    .text {
      margin-left: 6 * $range + 6px;
    }
  }
  .level-7 {
    .text {
      margin-left: 7 * $range + 6px;
    }
  }
  .icon-folder {
    width: 20px;
  }
  .icon-file {
    position: absolute;
    top: 3px;
    left: 5px;
    width: 14px;
  }
}

ul.explorer-ul-placeholder {
  list-style: none;
  margin: 0;
  padding: 0;
  li {
    list-style: none;
    height: 35px;
    line-height: 40px;
    .placeholder-text {
      margin-left: 28px;
      margin-top: 8px;
      + .placeholder-text {
        margin-left: 5px;
        margin-top: 8px;
      }
    }
  }
}

pre.prism-code {
  margin: 0;
  padding: 0;
  line-height: 24px;
  font-size: 13px;
  font-family: Monaco, Menlo, Consolas, 'courier new', monospace;
  span.explorer-number {
    position: relative;
    display: inline-block;
    width: 20px;
    padding-right: 10px;
    text-align: right;
    margin-right: 10px;
    font-size: 11px;
    height: 25px;
    &:before {
      display: block;
      content: attr(data-value);
      color: rgba(0, 0, 0, 0.2);
      position: absolute;
      width: 20px;
      left: 0;
      top: 9px;
      background-color: lighten($light-border, 8);
      padding-right: 10px;
      height: 25px;
    }
  }
  .token-line {
    height: 25px;
  }
  &.line-3 {
    width: 28px;
    span.explorer-number {
      width: 28px;
      &:before {
        width: 28px;
      }
    }
    &:before {
      width: 38px;
    }
  }

  &:before {
    position: absolute;
    top: 0;
    bottom: 0;
    display: block;
    width: 30px;
    content: '';
    background-color: lighten($light-border, 8);
  }
}

.markdown,
.markdown-source {
  position: relative;
  padding: $spring-8points $spring-8points * 4;
  a {
    color: $light-link;
    &:hover {
      text-decoration: none;
    }
    &:focus {
      outline: 1px dotted $light-link;
      box-shadow: 0 0 0 none;
    }
  }
  .button-source {
    position: absolute;
    right: 0;
    top: 0;
    line-height: 20px;
    margin: 10px 15px;
    color: rgba(0, 0, 0, 0.6);
    text-decoration: none;
    font-size: 13px;
    padding: 2px 12px;
  }
}
.markdown-source {
  padding: 0;
  height: 100%;
}

.explorer {
  position: fixed;
  top: 0%;
  left: 5rem;
  right: 5rem;
  background: $light-background;
  height: 100%;
  z-index: 100;
}

.explorer-enter {
  top: 100%;
}

.explorer-enter-active {
  transform: translateY(-100%);
  @include transition(all 500ms);
}

.explorer-exit {
  top: 0;
}

.explorer-exit-active {
  transform: translateY(100%);
  @include transition(all 500ms);
}

.explorer-actions {
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  background: $light-background-seconday;
  padding: 20px 0;
  bottom: 0;
  z-index: 400;
  height: 50px;
  vertical-align: top;
  .button {
    font-size: $spring-font-size + 1;
    vertical-align: top;
    span {
      padding: 0.9rem 1.5rem 0.8rem;
    }
    &:focus {
      box-shadow: 0 0 0 4px darken($light-border, 6);
    }
  }
}

.explorer-actions {
  .placeholder-button {
    height: 47.5px;
    box-shadow: inset 0 0 0 2px $light-border;
    margin-right: 1rem;
    vertical-align: top;
    &:after {
      background: $light-border;
    }
    &:last-child {
      margin-right: 0;
    }
  }
}

.placeholder-button-download {
  width: 212.27px;
}

@import 'responsive';
